rem
	bbdoc: Undocumented Function
end rem
Function TranslateScintillaHeader(srcpath:String, key:String)
	Process(srcpath, key)
End Function

Function Process(url:String, key:String)
	Local source:TStream = ReadFile(url)
	
	Local Line:String = ""
	Local str:String[]
	
	Local Constants:String = ""
	Local Methods:String = ""
	Local Helper:String = "Function " + key + "ToString:String(c:Int = 0)~n"
	Helper:+"~tSelect c~n"


	While Not Eof(source)
		Line = ReadLine(source)
		If Line.Startswith("#define") Then
			
			Line = Line.Replace("#define" , "Const")
			str = Line.split(" ")
		
			If str.Length > 2 Then
				Constants:+str[0] + " " + str[1] + ":Int = " + str[2] + " ~n"
				'If str[1].StartsWith("SCN")
					Helper:+"~t~tCase " + str[2].Replace("0x", "$") + " ~n"
					Helper:+"~t~t~tReturn ~q" + str[1] + "~q~n"
			'	End If
				
				If str[1].StartsWith("SCI") Then
					Methods:+ "Method SC_" +Chr(str[1][4])+ str[1][5..].toLower() + "()~n"
					Methods:+ "~tSendEditor(" + str[1] + ")~n"
					Methods:+"End Method~n~n"
				End if
			End If
		End If	
	Wend
	
	Helper:+"~t~tDefault~n"
	Helper:+"~t~tReturn ~qUnknown~q~n"
	Helper:+"~tEnd Select~n"
	Helper:+"End Function~n"
	
	SaveText(Constants, key + "_Constants.bmx")
	SaveText(Methods, key + "_Methods.bmx")
	SaveText(Helper, key + "_Helper.bmx")
	
	CloseFile(source)
End Function
